// 列表头按钮配置
import {getDict} from "@/api/common";
import {exportUrl} from "@/api/order/tmOrder";

// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.view"),
    type: "primary",
    class: "row-btn-primary",
    handleName: "view", // 点击时返回的标识
  },
  {
    name: '删除',
    type: "danger",
    class: "row-btn-primary",
    handleName: "delete", // 点击时返回的标识
  },
];
export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl,
    //auth: "auth:operlog:export", //权限字段
  },
  {
    name: '批量删除',
    type: "danger",
    icon: "el-icon-delete",
    handleName: "batchDelete", //点击时返回的标识
    //auth: "auth:operlog:export", //权限字段
  },
]
export function orderStateEnum(status) {
  switch (status) {
    case 0:
    case '0':
      return '未开工'
    case 4:
    case '4':
      return '工程师创建驳回'
    case 5:
    case '5':
      return '开工'
    case 6:
    case '6':
      return '报工'
    case 7:
    case '7':
      return '完工审核通过'
    case 8:
    case '8':
      return '完工审核驳回'
    case 9:
    case '9':
      return '工程师创建待审核'
    default:
      return '-'
  }
}
export function isDispenseEnum(status) {
  switch (status) {
    case 'N':
      return '未分配'
    case 'Y':
      return '已分配'
    default:
      return '-'
  }
}
export function reportTypeEnum(status) {
  switch (status) {
    case 1:
    case '1':
      return '复检报告'
    case 2:
    case '2':
      return '整备报告'
    case 3:
    case '3':
      return '下线质检'
    case 4:
    case '4':
      return '认证'
    default:
      return '-'
  }
}
export function reportStateEnum(status) {
  if(status.reportUrl === null || status.reportUrl === '' || status.reportUrl === undefined)
  {
    return '未生成'
  }
  else if (status.isPush === 'Y')
  {
    return '已推送'
  }
  else
  {
    return '待推送'
  }
}

export function reportStateTypeEnum(status) {
  if(status.reportUrl === null || status.reportUrl === '' || status.reportUrl === undefined)
  {
    return 'info'
  }
  else if (status.isPush === 'Y')
  {
    return 'success'
  }
  else
  {
    return ''
  }
}

export function mmcQuoteEnum(status) {
  switch (status) {
    case 'X':
      return '确认驳回'
    case 'N':
      return '未确认'
    case 'Y':
      return '确认通过'
    default:
      return '-'
  }
}
// 搜索条件配置
export const searchConfig = {
  data() {
    const self = this;
    return {
      searchDialog: {
        inline: true,
        formDesc: {
          orderState: {
            type: "select",
            label: '状态',
            prop: {
              text: "description",
              value: "value"
            },
            // Promise 对象
            options: async (data) => {
              const list = await getDict("mes_pick_up_order_status")
              return list.data.result
            }
          },
          searchNo: {
            type: "input",
            label: '订单编码',
          },
          vehicleXwName: {
            type: "input",
            label: '门店',
          },
          pushState: {
            type: 'select',
            label: '报价推送状态',
            options: (data) => {
              return [
                {
                  text: "未推送",
                  value: '0'
                },
                {
                  text: "部分推送",
                  value: '1'
                },
                {
                  text: "全部推送",
                  value: '2'
                },
              ]
            }
          },
          confimState: {
            type: 'select',
            label: '报价确认状态',
            options: (data) => {
              return [
                {
                  text: "未确认",
                  value: '0'
                },
                {
                  text: "部分确认",
                  value: '1'
                },
                {
                  text: "全部确认",
                  value: '2'
                },
              ]
            }
          },
          reportAState: {
            type: "select",
            options: [
              {text: "未生成", value: "0" },
              { text: "待推送", value: "N" },
              { text: "已推送", value: "Y" },
            ],
            label: '复检报告状态',
          },
          reportBState: {
            type: "select",
            options: [
              {text: "未生成", value: "0" },
              { text: "待推送", value: "N" },
              { text: "已推送", value: "Y" },
            ],
            label: '整备报告状态',
          },
          reportCState: {
            type: "select",
            options: [
              {text: "未生成", value: "0" },
              { text: "待推送", value: "N" },
              { text: "已推送", value: "Y" },
            ],
            label: '下线质检报告状态',
          },
          reportDState: {
            type: "select",
            options: [
              {text: "未生成", value: "0" },
              { text: "待推送", value: "N" },
              { text: "已推送", value: "Y" },
            ],
            label: '认证报告状态',
          },
        },
      },
    };
  },
};


// 新增/删除表单配置
